package org.example.controller;

import org.example.entity.Provider;
import org.example.param.ProviderParam;
import org.example.service.ProviderService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import java.util.Map;

@RestController
@RequestMapping("/provider")
public class ProviderController {
    @Resource
    ProviderService providerService;

    @PostMapping("/save")
    public Map<String, Object> save(Provider provider) {
        return providerService.save(provider);
    }
    @GetMapping("/page")
    public Map<String,Object> page(ProviderParam param) {
        return providerService.page(param);
    }
    @PostMapping("/disable")
    public Map<String, Object> disable(Provider provider) {
        return providerService.disable(provider);
    }
    @PostMapping("/batch-import")
    public Map<String, Object> batchImport(MultipartFile file) {
        return providerService.importExcel(file);
    }
    @PostMapping("/delete")
    public Map<String,Object>delete(Provider provider){return providerService.delete(provider);}


}
